Remove GNU PBDS dependence in stats classes and improve ArgMinMax implementation #75
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of changes
Removed PBDS dependence in order statistics. If gcc is being used we used the PBDS tree, if not we use a std::multiset. The downside of this is that for Quantile/Rank, we need to iterate on the set to find the desired value which is O(n). Before, in the PBDS order statistics tree, the complexity of find is O(log n). I did research on replacing the pbds tree and there is no readily available equivalent data structure. I will open an issue as a good starter task for someone to implement a data structure for this use.
Realized I could do ArgMinMax more efficiently. With the pbds tree it was O(log n) insert/delete and find. Using the AscendingMinima monotonic queue, it's O(1) amortized for all those operations.